<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex shoppingCart_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between shoppingCart_fd0_0'>
					<view class='flex flex-wrap align-center shoppingCart_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  shoppingCart_fd0_0_c0_c0'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='shoppingCart_fd0_0_c1_c0'>购物车</text>
					</view>
					<view class='flex align-center justify-end shoppingCart_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-wrap align-center justify-end benben-flex-layout shoppingCart_flex_1">
				<text class='shoppingCart_fd1_0' v-if="is_edit===false" @tap.stop="editTabFunc()">管理</text><text
					class='shoppingCart_fd1_0' v-if="is_edit===true" @tap.stop="editTabFunc()">完成</text>
			</view>

			<!---flex布局flex布局结束-->
			<benben-shop-cart class='shoppingCart_flex_cart_2' :is-editor.sync='is_edit' :cart-list.sync='dataList'
				:cart-ids.sync='dataId' :cart-id.sync='clickId' :goods-id.sync='clickShopId'
				:sku-id.sync='clickShopSpecifications' :cart-num.sync='num' @toGoods="goShopDetailFunc()"
				@navToLogin="goLogonFunc()" @navToHome="jumpIndexFunc()" @delCart="deteleFunc()"
				@createOrder="ConfirmOrderFunc()" @numberChange="buyNumFunc()" @changeSku="getShopDetailFunc()">
				<template #login>
					<view class='flex flex-direction flex-wrap align-center'>
						<image class='shoppingCart_shopCart0_0_c0' mode="aspectFit" :src='STATIC_URL+"407.png"'></image>
						<text class='shoppingCart_shopCart0_0_c1'>您的还没登录，快去登录吧</text>
						<button class='shoppingCart_shopCart0_0_c2' @tap.stop="handleJumpDiy" data-type="reLaunch"
							:data-url="`/pages/tabBar/login/login`">去登录</button>
					</view>
				</template><template #empty>
					<view class='flex flex-direction flex-wrap align-center'>
						<image class='shoppingCart_shopCart0_0_c0' mode="aspectFit" :src='STATIC_URL+"407.png"'></image>
						<text class='shoppingCart_shopCart0_0_c1'>您的购物车还没有商品，快去挑选吧</text>
						<button class='shoppingCart_shopCart0_0_c2'>去挑选好货</button>
					</view>
				</template>
			</benben-shop-cart>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout shoppingCart_flex_3"
				v-if=" dataList.length==''">
				<view class='flex flex-wrap align-center justify-center'>
					<image class='shoppingCart_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"34.png"'></image>
					<text class='shoppingCart_fd3_0_c1'>猜你喜欢</text>
					<image class='shoppingCart_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"35.png"'></image>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---订单列表flex布局开始-->
			<view class="flex flex-wrap align-center benben-flex-layout shoppingCart_flex_4"
				v-if=" dataList.length==''">
				<template v-for='(item,key0) in shopList'>
					<view class='flex flex-direction flex-wrap align-stretch shoppingCart_fd4_0'
						@tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/newShop/goodsDetails/goodsDetails?shop_id=${item.aid}`" :key='key0'>
						<image class='shoppingCart_fd4_0_c0' mode="scaleToFill" :src='item.thumb'></image>
						<view class='flex flex-direction flex-wrap align-stretch shoppingCart_fd4_0_c1'>
							<text class='flex-sub shoppingCart_fd4_0_c1_c0'>{{item.name}}</text>
							<view class='flex flex-wrap align-center shoppingCart_fd4_0_c1_c1'>
								<text class='shoppingCart_fd4_0_c1_c1_c0'>销量</text>
								<text class='flex-sub shoppingCart_fd4_0_c1_c1_c1'>{{item.sales_sum}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='shoppingCart_fd4_0_c1_c2_c0'>￥</text>
								<text class=' shoppingCart_fd4_0_c1_c2_c1'>
									<text
										class=' shoppingCart_price1_fd4_0_c1_c2_c1'>{{ item.shop_price | frontPrice }}</text>
									<text
										class=' shoppingCart_price2_fd4_0_c1_c2_c1'>{{ item.shop_price | laterPrice }}</text>
								</text>
								<text class='shoppingCart_fd4_0_c1_c2_c2'>￥</text>
								<text class=' shoppingCart_fd4_0_c1_c2_c3'>
									<text>{{ item.market_price | frontPrice }}</text>
									<text
										class=' shoppingCart_price2_fd4_0_c1_c2_c3'>{{ item.market_price | laterPrice }}</text>
								</text>
							</view>
						</view>
					</view>
				</template>
				<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
					:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
			</view>

			<!---订单列表flex布局结束-->
			<benben-specs-popup ref="specsPopup1695884396600" class='shoppingCart_flex_specs_5' price-name='shop_price'
				:speclist='dataDetails.spec_list' :skulist='dataDetails.sku_list' :sku-id.sync='clickShopSpecifications'
				:sku-name.sync='sku_name' :price.sync='dataDetails.shop_price' :thumb.sync='dataDetails.thumb'
				:market-price.sync='dataDetails.market_price' :stock.sync='dataDetails.stock' :number.sync='num'
				@confirm="confirmSelectionFunc()">
			</benben-specs-popup>


		</view>
	</view>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"dataList": [],
				"dataId": "",
				"clickId": "",
				"num": "",
				"clickShopId": "",
				"clickShopSpecifications": "",
				"sku_name": "",
				"dataDetails": {
					"id": "",
					"cid": "",
					"adslogan": "",
					"name": "",
					"sales_sum": "",
					"spectypeid": "",
					"click": "",
					"is_recommend": "",
					"is_new": "",
					"is_hot": "",
					"shop_price": "",
					"member_price": "",
					"market_price": "",
					"images": [],
					"thumb": "",
					"body": "",
					"description": "",
					"stock": "",
					"is_spec": "",
					"is_shipping": "",
					"freight_price": "",
					"support_self_mention": "",
					"freight_template_id": "",
					"partner_id": "",
					"video": "",
					"video_img": "",
					"share_award_money": "",
					"discounts": "",
					"spec_list": [],
					"sku_list": {
						"sku_id": "",
						"key": "",
						"key_name": "",
						"member_price": "",
						"shop_price": "",
						"market_price": "",
						"stock": ""
					},
					"coupon_list": [],
					"activity_info": {
						"activity_type": ""
					},
					"user_level": "",
					"is_collect": "",
					"comment_total": "",
					"praise_rate": "",
					"freight_explain": "",
					"freight_name": "",
					"sale_top_name": "",
					"question_total": "",
					"question_list": [],
					"goods_type": "",
					"chat_price": "",
					"shop_info": {
						"store_id": "",
						"store_name": "",
						"store_logo": "",
						"level_name": "",
						"store_star": "",
						"store_collection_num": ""
					},
					"warm_prompt": "",
					"comment": []
				},
				"is_edit": false,
				"shopList": []
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getShopFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.DataListFunc()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.DataListFunc()
			this.getShopFunc()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取购物车列表
			async DataListFunc() {
				//请求方法
				//数据验证

				let datadataList = await this.$api.get(global.apiUrls.post62b981f24a040, {

				});

				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data

			},
			//删除购物车
			async deteleFunc() {
				//请求方法
				//数据验证

				let data62b9854aa2c4e = await this.$api.dbGet(global.apiUrls.post62b9854aa2c4e, {
					id: this.dataId
				});
				if (!data62b9854aa2c4e) return
				if (data62b9854aa2c4e.data.code != 1) {
					this.$message.info(data62b9854aa2c4e.data.msg);
					return
				}



				this.is_edit = false;
				this.$message.info('删除成功');
				this.DataListFunc()
			},
			//购物车商品数量操作
			async buyNumFunc() {
				//请求方法
				//数据验证

				let data62cf8cc5678f0 = await this.$api.get(global.apiUrls.post62cf8cc5678f0, {
					aid: this.clickId,
					num: this.num
				});

				if (data62cf8cc5678f0.data.code != 1) {
					this.$message.info(data62cf8cc5678f0.data.msg);
					return
				}



			},
			//跳转商品详情
			goShopDetailFunc() {
				this.$urouter.navigateTo(`/pages/newShop/goodsDetails/goodsDetails?shop_id=${this.clickShopId}`);
			},
			//跳转登录
			goLogonFunc() {
				this.$urouter.reLaunch(`/pages/tabBar/login/login`);
			},
			//获取商品详情规格
			async getShopDetailFunc() {
				//请求方法
				//数据验证

				let datadataDetails = await this.$api.get(global.apiUrls.post641987361d887, {
					goods_id: this.clickShopId
				});

				if (datadataDetails.data.code != 1) {
					this.$message.info(datadataDetails.data.msg);
					return
				}
				let infodataDetails = datadataDetails.data;
				this.dataDetails = infodataDetails.data

				this.$refs.specsPopup1695884396600.open('confirm');
			},
			//跳转确认订单
			ConfirmOrderFunc() {
				this.$urouter.navigateTo(`/pages/newShop/cartPay/cartPay?shoppingCart_id=${this.dataId}`);
			},
			//确认选择
			async confirmSelectionFunc() {
				//请求方法
				//数据验证

				let data62cf89c460a19 = await this.$api.get(global.apiUrls.post62cf89c460a19, {
					aid: this.clickId,
					goods_id: this.clickShopId,
					sku_id: this.clickShopSpecifications,
					sku_name: this.sku_name,
					shop_price: this.dataDetails.shop_price,
					num: this.num
				});

				if (data62cf89c460a19.data.code != 1) {
					this.$message.info(data62cf89c460a19.data.msg);
					return
				}



				this.DataListFunc()
				this.$refs.specsPopup1695884396600.close();
			},
			//是否编辑
			editTabFunc() {
				if (this.is_edit === false) {
					this.is_edit = true;
					return
				} else if (this.is_edit === true) {
					this.is_edit = false;
					return
				}
			},
			//跳转首页
			jumpIndexFunc() {
				this.$urouter.navigateTo(`/pages/tabBar/shoppingIndex/shoppingIndex`);
			},
			//获取商品列表
			getShopFunc() {
				this.minixPagingListsApi = global.apiUrls.post6459bde8ae548;
				this.pageingListApiMethod = 'get';
				this.allowOnloadGetList = false;
				this.pagingListPostDataContent = {}
				this.listData = [];
				this.shopList = this.listData;
				this.pagingListToggle();

			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.shoppingCart_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.shoppingCart_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
	}

	.shoppingCart_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.shoppingCart_fd0_0_c0 {
		width: 200rpx;
		height: 88rpx;
	}

	.shoppingCart_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.shoppingCart_flex_1 {
		padding: 24rpx 32rpx 24rpx 32rpx;
	}

	.shoppingCart_fd1_0_1 {
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(48, 144, 255, 1);
	}

	.shoppingCart_fd1_0 {
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor4);
	}

	.shoppingCart_shopCart0_0_c2 {
		background: var(--benbenbgColor2);
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		width: 400rpx;
		line-height: 80rpx;
		font-size: 32rpx;
		color: #fff;
	}

	.shoppingCart_shopCart0_0_c1 {
		font-size: 24rpx;
		color: var(--benbenFontColor1);
		margin: 0rpx 0rpx 40rpx 0rpx;
	}

	.shoppingCart_shopCart0_0_c0 {
		width: 456rpx;
		height: 228rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.shoppingCart_flex_cart_2 {
		--nav-btn-bg: var(--benbenbgColor2);
		--checked-active: var(--benbenFontColor4);
		--del-btn-color: #ffffff;
		--del-btn-bg: #343434;
		--submit-btn-bg: var(--benbenbgColor2);
	}

	.shoppingCart_flex_3 {
		margin: 20rpx 0rpx 20rpx 0rpx;
	}

	.shoppingCart_fd3_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		margin: 0rpx 24rpx 0rpx 24rpx;
	}

	.shoppingCart_fd3_0_c0 {
		width: 60rpx;
		height: 29rpx;
	}

	.shoppingCart_flex_4 {
		padding: 12rpx 19rpx 12rpx 19rpx;
	}

	.shoppingCart_price2_fd4_0_c1_c2_c3 {
		font-size: 24rpx;
	}

	.shoppingCart_fd4_0_c1_c2_c3 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		text-decoration: line-through;
	}

	.shoppingCart_fd4_0_c1_c2_c2 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		margin: 0rpx 0rpx 0rpx 8rpx;
		text-decoration: line-through;
	}

	.shoppingCart_price2_fd4_0_c1_c2_c1 {
		font-size: 22rpx;
	}

	.shoppingCart_price1_fd4_0_c1_c2_c1 {
		font-size: 32rpx;
		font-weight: 700;
		color: #FF4133;
	}

	.shoppingCart_fd4_0_c1_c2_c1 {
		color: #ff5536;
		font-weight: 600;
		font-size: 32rpx;
	}

	.shoppingCart_fd4_0_c1_c2_c0 {
		font-size: 22rpx;
		font-weight: 700;
		color: #FF4133;
	}

	.shoppingCart_fd4_0_c1_c1_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		line-height: 33rpx;
	}

	.shoppingCart_fd4_0_c1_c1_c0 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.shoppingCart_fd4_0_c1_c1 {
		margin: 16rpx 0rpx 24rpx 0rpx;
	}

	.shoppingCart_fd4_0_c1_c0 {
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
		line-height: 33rpx;
		height: 66rpx;
	}

	.shoppingCart_fd4_0_c1 {
		margin: 24rpx 16rpx 24rpx 16rpx;
	}

	.shoppingCart_fd4_0_c0 {
		width: 346rpx;
		height: 346rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.shoppingCart_fd4_0 {
		background: #fff;
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		margin: 5rpx 5rpx 5rpx 5rpx;
		width: 346rpx;
	}

	.shoppingCart_flex_specs_5 {
		--active-sku-tag-color: #fa2033;
		--active-sku-tag-bg: #fff2ef;
		--sku-tag-color: #33333;
		--sku-tag-bg: #f5f5f5;
		--cart-btn-bg: #343434;
		--buy-btn-bg: linear-gradient(126deg, #fa2033 0%, #ff6530 100%);
		--confirm-btn-bg: linear-gradient(126deg, #fa2033 0%, #ff6530 100%);
	}
</style>